package 基础;
import java.lang.String;
import java.nio.charset.Charset;
public class Testx {
	
	public static void main(String[] args) {
		Persony person=new Persony.Builder(1, "张小毛").age(20).sex("男").phone("1234567890").build();
		System.out.println(person);
		String str="abcd";
		System.out.println(str.hashCode());
	}
}
class Persony{
	private final int id;
	private final String name;
	private int age;
	private String sex;
	private String phone;
	
	public Persony(Builder builder) {
		this.id=builder.id;
		this.name=builder.name;
		this.age=builder.age;
		this.sex=builder.sex;
		this.phone=builder.phone;
	}
	public static class Builder{
		private final int id;
		private final String name;
		private int age;
		private String sex;
		private String phone;
		
		public Builder(int id,String name) {
			this.id=id;
			this.name=name;
		}
		public Builder age(int val) {
			this.age=val;
			return this;
		}
		public Builder sex(String val) {
			this.sex=val;
			return this;
		}
		public Builder phone(String val) {
			this.phone=val;
			return this;
		}
		public Persony build() {
			return new Persony(this);
		}
	}
	@Override
	public String toString(){
		return "Person [id=" + id + ", name=" + name + ", age=" + age + ", sex=" + sex + ", phone =" + phone + "]";
	}
}